package pro.shushi.pamirs.hr.api.model.biz;

import pro.shushi.pamirs.boot.base.ux.annotation.field.UxWidget;
import pro.shushi.pamirs.boot.base.ux.annotation.view.UxDetail;
import pro.shushi.pamirs.boot.base.ux.annotation.view.UxForm;
import pro.shushi.pamirs.boot.base.ux.annotation.view.UxTable;
import pro.shushi.pamirs.meta.annotation.Field;
import pro.shushi.pamirs.meta.annotation.Model;
import pro.shushi.pamirs.meta.base.IdModel;
import pro.shushi.pamirs.meta.enmu.NullableBoolEnum;

import java.math.BigDecimal;
import java.util.List;

// 模型中UX开头的注解(UxForm/UxTable/UxDetail等)可以不用写，都可在设计器中进行可视化配置; 代码里面写这些注解是为了默认页面的交互
@Model.model(ExpenseBillDetail.MODEL_MODEL)
@Model(displayName = "报销明细", labelFields = "item")
public class ExpenseBillDetail extends IdModel {

    public static final String MODEL_MODEL = "hr.simple.ExpenseBillDetail";

    @Field(displayName = "报销单号", invisible = true, index = true)
    private String billCode;

    @Field(displayName = "费用项", required = true)
    private String item;

    @Field(displayName = "事由", required = true)
    private String reason;

    @Field.Money(D = 2)
    @Field(displayName = "报销金额", required = true)
    private BigDecimal amount;

    @UxForm.FieldWidget(@UxWidget(widget = "Upload"))
    @UxTable.FieldWidget(@UxWidget(widget = "Upload"))
    @UxDetail.FieldWidget(@UxWidget(widget = "Upload"))
    @Field.Advanced(columnDefinition = "TEXT")
    @Field(displayName = "附件（电子发票）", serialize = Field.serialize.COMMA,
            store = NullableBoolEnum.TRUE, multi = true, required = true)
    private List<String> attachment;

    @Field.Text
    @Field(displayName = "费用明细")
    private String feeDetails;
}
